// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.

import 'package:flutter_test/flutter_test.dart';
import 'package:mybase/base/tool/entitylog/MyEntityTestRun.dart';
import 'package:mybase/base/tool/entitylog/MyLanguageTestRun.dart';
import 'package:mybase/base/tool/file/FFile.dart';
import 'dart:convert';

Future<void> main() async {
  const List<String> languages = ["zh-Hans","zh-Hant"];

  for (int i = 0; i < languages.length; i++) {
    String code = languages[i];

    await MyLanguageTestRun.createLanguageCode(
      templateFile: "/Users/os/spotify/spotify/assets/language/en.json",
      targetFile: "/Users/os/spotify/spotify/assets/language/${code}.json",
    );
  }

  String allJsonStr = await FFile.readAsString(
      "/Users/os/spotify/spotify/assets/language/en.json");
  Map<String, dynamic> map = json.decode(allJsonStr);

  await MyEntityTestRun.createEntityCode(
      map: map,
      targetDir: "/Users/os/spotify/spotify/lib/config/language/",
      entityClassName: "LanguageEntity",
      forceFlush: true);

  // await MyLanguageTestRun.createLanguageCode(
  //   templateFile: "/Users/os/spotify/spotify/assets/language/all.json",
  //   targetFile: "/Users/os/spotify/spotify/assets/language/en.json",
  // );
  print("执行完毕");
}
